from base import Base
from selenium.webdriver.common.by import By
from time import sleep

class SousuoPage(Base):

    sousuokuang = 'new UiSelector().text("搜索菜谱")'

    shurukuang = 'new UiSelector().resourceId("com.xiachufang:id/search_edit_text")'

    sousuoanniu = (By.XPATH,'/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.RelativeLayout[3]/android.widget.TextView')

    dy = (By.XPATH,'//android.widget.TextView[@text="调料汁"]')

    def sousuoyewu(self,content):
        self.find_ele(self.sousuokuang).click()
        sleep(2)
        self.find_ele(self.shurukuang).send_keys(content)
        sleep(2)
        self.find_ele(self.sousuoanniu).click()
        sleep(2)
